package com.cskaoyan.exceptionhandler;

import com.cskaoyan.vo.BaseRespVo;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class JSONExceptionHandler {

    @ExceptionHandler(value = HttpMessageNotReadableException.class)
    @ResponseBody
    public BaseRespVo duplicateKeyExceptionHandler(Exception e){
        e.printStackTrace();
        return BaseRespVo.error("参数数据类型错误！请检查！");
    }

}
